/*
 *  CS202 - Spring 2009">
 *  Professor: Dr. Michael Peterson">
 *  Student: Deylo Woo (dwoo711@gmail.com) ">
 */
package project_3_v_2;

import java.awt.*;

/**
 * Cannon class, it inherits from MovingObject
 */
public class Cannon extends MovingObject {

    /**
     * Default constructor
     */
    public Cannon() {
        super();

    }

    /**
     * Second Cosntructor
     * @param xCoord: x coordinate on panel
     * @param yCoord: y coordinate on panel
     * @param height: actual height
     * @param width: actual width
     * @param rise: velocity moving vertically
     * @param run: velocity moving horizontally
     * @param color: actual color
     */
    public Cannon(int xCoord, int yCoord, int height, int width, int rise, int run, Color color) {
        super(xCoord, yCoord, height, width, rise, run, color);

    }

    /**
     * Reposition objects by setting x, y coordinates
     * @param pPanelHeight: parent panel height for proper resizing of window
     * @param pPanelWidth: parent panel width for proper resizing of window
     */
    @Override
    public void Move(int pPanelHeight, int pPanelWidth) {

        if (_xCoord < (0 - _run) || _xCoord > (pPanelWidth - _width)) {
            _run = -_run;
        }

        _xCoord += _run;
        _yCoord = pPanelHeight - 20;
    }
}
